package com.wgl.yygh.controller;

import com.wgl.cmnclient.inteface.DictFeignClient;
import com.wgl.model.hosp.Hospital;
import com.wgl.model.vo.hosp.HospitalQueryVo;
import com.wgl.yygh.result.Result;
import com.wgl.yygh.serivce.HospitalService;
import com.wgl.yygh.serivce.HospitalSetService;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wgl
 * @version 1.0.0
 * @ClassName HospitalController.java
 * @Description TODO
 * @createTime 2022年02月06日 21:11:00
 */
@RestController
@RequestMapping("/admin/hosp/hospital")
//@CrossOrigin
public class HospitalController {
    @Resource
    private HospitalService hospitalService;

    /**
     * @Author: Wgl
     * @Description: 查询医院详情
     * @Date: 2022/2/7 21:29;
     * @param id: ;
     * @return: com.wgl.model.hosp.Hospital;
     */
    @GetMapping("/showHospDetail/{id}")
    public  Result showHospDetail(@PathVariable String id){
        return Result.ok(hospitalService.getHospById(id));
    }


    /**
    * @Author: Wgl
    * @Description: 更新医院上下线状态
    * @Date: 2022/2/7 20:44;
    * @param id:
     * @param status: ;
    * @return: com.wgl.yygh.result.Result;
    */
    @GetMapping("/updateStatus/{id}/{status}")
    public Result updateStatus(@PathVariable String id, @PathVariable  Integer status){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }
    /**
    * @Author: Wgl
    * @Description: 根据分页数和条件查询 mongoDB数据库中的医院信息
    * @Date: 2022/2/6 23:41;
    * @param page:
     * @param limit:
     * @param hospitalQueryVo: ;
    * @return: com.wgl.yygh.result.Result;
    */
    @GetMapping("/list/{page}/{limit}")
    public Result list(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pages = hospitalService.selectHospPage(page,limit,hospitalQueryVo);

        return Result.ok(pages);
    }

}
